<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script th:src="@{/layui/layui.js}" type="text/javascript"></script>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
</head>
<body>
<div class="layui-container" style="margin: 10px 0px; ">
    <form class="layui-form layui-form-pane">
        <input type="hidden" name="id" th:value="${ae.id}">
        <div class="layui-form-item">
            <label class="layui-form-label">地址id</label>
            <div class="layui-input-block" style="width: 225px;">
                <input type="text" class="layui-input" name="id" style="cursor:not-allowed;color: #9F9F9F" disabled th:value="${ae.id}"  autocomplete="off" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户id</label>
            <div class="layui-input-block" style="width: 225px;">
                <input type="text" class="layui-input" name="userId" style="cursor:not-allowed;color: #9F9F9F" disabled th:value="${ae.userId}"   autocomplete="off" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">收货人名称</label>
            <div class="layui-input-block" style="width: 225px;">
                <input type="text" class="layui-input" name="receiver" style="cursor:not-allowed;color: #9F9F9F" disabled th:value="${ae.receiver}"  autocomplete="off" />
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">用户手机</label>
            <div class="layui-input-block" style="width: 225px;">
                <input type="text" class="layui-input" name="phone" style="cursor:not-allowed;color: #9F9F9F" disabled th:value="${ae.phone}" autocomplete="off" />
            </div>

        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">默认</label>
            <div class="layui-input-block" style="width: 150px;">
                <select type="text" class="layui-input" name="status" th:value="${ae.status}" autocomplete="off" >
                    <option value="1" th:selected="${ae.status}=='1'">是</option>
                    <option value="2" th:selected="${ae.status}=='2'">否</option>
                </select>
            </div>
        </div>

        <div class="layui-form-item" style="display: none;">
            <div class="layui-input-block">
                <a class="layui-btn" id="submitBtn" lay-submit="" lay-filter="submitBtn">提交</a>
            </div>
        </div>
    </form>
</div>
<script>
    var $;
    layui.use(['table','layer','form','jquery','dropdown'],function() {
        var table = layui.table,
            form = layui.form,
            layer = layui.layer,
            dropdown= layui.dropdown;
        $ = layui.jquery;

        form.on('submit(submitBtn)',function (data) {
            var formData = data.field;
            $.ajax({
                type:'post',
                url:'/address/ra/update',
                data:formData,
                dataType:'json',
                success:function (result) {
                    layer.msg(result.msg);
                    if(result.is){
                        let index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭父页面窗口
                    }
                }
            })
        });

    });
    function btnSubmit(){
        $('#submitBtn').click();
    }
</script>
</body>
</html>